import React from 'react';
import PropTypes from 'prop-types';
import styles from './style.module.less';

const SvgIcon = props => {
  const { iconClass, fill } = props;

  return (
    <i aria-hidden="true"
      className="anticon">
      <svg className={styles['svg-class']}>
        <use fill={fill}
          xlinkHref={'#icon-' + iconClass} />
      </svg>
    </i>
  );
};

SvgIcon.propTypes = {
  // svg名字
  iconClass: PropTypes.string.isRequired,
  // 填充颜色
  fill: PropTypes.string
};

SvgIcon.defaultProps = {
  fill: 'currentColor'
};

export default SvgIcon;
